{include 'public/header.html'}

<div class="main-content">

<div class="page-content">

  <div class="page-content-area" style="opacity: 0.8;"> <br>

    <div class="page-header">

      <h1> 班级管理 <small><i class="ace-icon fa fa-angle-double-right"></i> {if $row.id}编辑{else}新增{/if}班级 </small> </h1>

    </div>

    <div class="row">

      <div class="panel panel-default">

        <div class="panel-body table-responsive">

          <form method="post" class="form-horizontal" role="form" id="submitform" onsubmit="return false">

            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="name">名称</label>

                <input type="text" class="form-control" id="classes" name="classes" value="{$row.classes}">

              </div>

            </div>

            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="name">老师</label>

                <select name="tid" id="tid" class="form-control">

                  <option value="">请选择</option>

                  {foreach $techer as $v}

                  <option value="{$v.id}" {if $v.id==$row.tid}selected{/if} >{$v.name}, {$v.phone}</option>

                  {/foreach}

                </select>

              </div>

            </div>

            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="name">排序</label>

                <input type="text" class="form-control" id="score" name="score" value="{$row.score}">

              </div>

              </div>
              <div class="form-group">
              <div class="col-md-6">
                <label class="control-label" for="name">开始时间</label>
                <input type="text" name="start" id="s" value="{$row.start}"/>
              </div>
            </div>
            <div class="form-group">
              <div class="col-md-6">
                <label class="control-label" for="name">结束时间</label>
                <input type="text" name="end" id="e" value="{$row.end}"/>
              </div>
            </div>
            <div class="form-group">

              <div class="col-md-6">

                <label class="control-label" for="appsecret">描述</label>

                <textarea class="form-control" name="info">{$row.info}</textarea>

              </div>

            </div>

            <div class="form-group">

              <div class="col-md-6">

                <button type="submit" class="btn btn-primary btn-lg btn-submit">提交</button>

              </div>

            </div>

          </form>

        </div>

      </div>

    </div>

  </div>

</div>
<script>

  $("#s").timepicki();
  $("#e").timepicki();

</script>
<script>

var isbusy = false;

$(function(){

	$('#submitform').validate({

		focusInvalid: true,

		rules: {

			//title: {

				//required: true

			//}

		}

	});

	$('.btn-submit').click(function(){

		if(!$('#submitform').valid())return false;

		if(isbusy)return false;

		isbusy = true;

		tooltipbox.show('正在执行操作...');

		$.post(location.href, $('#submitform').serialize(), function(res){

		    if(res.code == 1){

				location.href = '{siteurl("con=admin/classes")}';

			}

			tooltipbox.show(res.msg);	

			isbusy = false;

		}, 'json').error(function(a, b, c){

			tooltipbox.show('数据或网络错误');

			isbusy = false;

		});

	});

});

</script> 

{include 'public/footer.html'} 